/*
 * @Description: 登记 - 电子档案销毁登记相关接口
 * @Author: Rfan
 * @Date: 2022-11-23 11:27:41
 * @LastEditTime: 2022-11-23 18:35:23
 */

import request from '@/utils/request';
import { Key } from 'react';
import { IPageQuery } from '@/interfaces/global';

export interface IRegDestructionListParams {
  archiveBoxId?: number;
  archiveBoxName?: string;
  archiveDesc?: string;
  archiveTypeId?: number;
  archiveTypeName?: string;
  boxTotalWidth?: number;
  category?: string;
  createTime?: string;
  dataSize?: number;
  detectionJobId?: number;
  duration?: number;
  efileCount?: number;
  endTime?: string;
  fileCount?: number;
  folderCount?: number;
  fondsId?: number;
  fondsName?: string;
  fondsNo?: string;
  id?: number;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  pageCount?: number;
  registrant?: string;
  registrationTime?: string;
  remark?: string;
  retentionPeriod?: string;
  secret?: string;
  startTime?: string;
  unitName?: string;
  year?: string;
}

// 分页查询电子档案销毁登记列表
export function fetchRegDestructionListByPage(data: IPageQuery<IRegDestructionListParams>) {
  return request({
    url: `/register-destroy/page`,
    method: 'post',
    data
  });
}

export interface IAddRegDestructionParams {
  archiveBoxId: number;
  archiveBoxName: string;
  archiveDesc: string;
  archiveTypeId: number;
  boxTotalWidth: number;
  category: string;
  dataSize: number;
  detectionJobId: number;
  duration: number;
  efileCount: number;
  endTime: string;
  fileCount: number;
  folderCount: number;
  fondsId: number;
  pageCount: number;
  registrant: string;
  registrationTime: string;
  remark: string;
  retentionPeriod: string;
  secret: string;
  startTime: string;
  unitName: string;
  year: string;
}

// 添加电子档案销毁登记条目
export function addRegDestruction(data: IAddRegDestructionParams) {
  return request({
    url: `/register-destroy/`,
    method: 'post',
    data
  });
}

export interface IEditRegDestructionParams extends IAddRegDestructionParams {
  id: number;
}
// 编辑电子档案销毁登记条目
export function editRegDestruction(data: IEditRegDestructionParams) {
  return request({
    url: `/register-destroy/`,
    method: 'put',
    data
  });
}

// 删除电子档案销毁登记条目
export function deleteRegDestructionItem(id: Key) {
  return request({
    url: `/register-destroy/${id}`,
    method: 'delete'
  });
}
